﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using Windows.UI.Xaml.Media.Imaging;
using Newtonsoft.Json;
using XEurope.JsonClasses;
using Windows.Storage;

namespace XEurope.Common
{
    public static class ConnHelper
    {
        /// <summary>
        /// Contains the Dtouch servivice base URL, ending with '/'
        /// </summary>
        public const String BaseUri = "http://xeurope.eitictlabs.hu/dtouch_service/v1/";
        public const String DtouchProcessUri = "http://www.dtouch.somee.com/api/dtouch/";
        private static readonly DatabaseHelperClass Db_Helper = new DatabaseHelperClass();

        public static void Logout()
        {
            ApplicationData.Current.LocalSettings.Values["CurrentUserMail"] = "";
            ApplicationData.Current.LocalSettings.Values["FirstLaunch"] = true;
            ApplicationData.Current.LocalSettings.Values["ApiKey"] = "";

            Db_Helper.DeleteAllScan();
        }

        public static string AddHttpToUrl(string inUrl)
        {
            inUrl = inUrl ?? String.Empty;
            if (!(inUrl.StartsWith("http://") || inUrl.StartsWith("https://")))
            {
                return "http://" + inUrl;
            }   
            return inUrl;
        }

        public static byte[] GetSampleImageBytes()
        {
            return
                Convert.FromBase64String(
                    "iVBORw0KGgoAAAANSUhEUgAAA/8AAAMFCAYAAAAiC0YpAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHCwAAjBEAAOe7AACIlQAAil8AAN25AAA+FQAAKL9mzVhBAAAYH2lDQ1BJQ0MgUHJvZmlsZQAAWMOtWXVUVN+3P3fuBAzD0N1d0g3S3d0IDN3dqKRIqAgCioAKKggqGJSIhSAhIqiAgUgYlAoKKALyLqHfX6z3x1vrnbXunc/ss/e+n3P2PufcPQMAGzMpPDwYRQ1ASGh0pLWBNrejkzM3bgzgAQugBHwATfKKCteytDQF/2tbGQbQ1udz8S1f4P/WaLx9orwAgCwR7Okd5RWC4AYA0Kxe4ZHRAGAGEDlfXHT4Fl5CMH0kQhAALNkW9tvB7FvYcwdLbevYWusgWBcAMgK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ACQn/AMAAEBywj8AAAAkJ/wDAABAcsI/AAAAJCf8AwAAQHLCPwAAACQn/AMAAEBywj8AAAAkJ/wDAABAcsI/AAAAJCf8AwAAQHLCPwAAACQn/AMAAEBywj8AAACk9vr1/wdomAfbvIz9fAAAAABJRU5ErkJggg==");
        }

        public static async Task<string> PostToUri(Uri uri, string postdata, string authHeader = null)
        {
            // "c7dda4ed33ff8f5220ebb597cd823c01"
            string apiKey;
            try {
                apiKey = ApplicationData.Current.LocalSettings.Values["ApiKey"].ToString();
            }
            catch {
                apiKey = null;
            }
            
            authHeader = authHeader ?? apiKey;
            var received = String.Empty;
            try
            {
                var request = (HttpWebRequest)WebRequest.Create(uri);
                request.Method = "POST";
                if (!String.IsNullOrEmpty(authHeader))
                {
                    request.Headers["Authorization"] = authHeader;
                }

                byte[] data = Encoding.UTF8.GetBytes(postdata);
                
                //request.ContentLength = data.Length;
                request.ContentType = "application/json";

                using (var requestStream = await Task<Stream>.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, request))
                {
                    await requestStream.WriteAsync(data, 0, data.Length);
                }

                WebResponse responseObject = null;
                try
                {
                    responseObject = await Task<WebResponse>.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, request);
                    var responseStream = responseObject.GetResponseStream();
                    var sr = new StreamReader(responseStream);
                    received = await sr.ReadToEndAsync();
                }
                catch (WebException ex)
                {
                    using (var stream = ex.Response.GetResponseStream())
                    using (var reader = new StreamReader(stream))
                    {
                        //var sr = reader.ReadToEnd();
                        received = reader.ReadToEnd();
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                    received = JsonConvert.SerializeObject(new ErrorJson { error = true, message = ex.Message });
                }

            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                received = JsonConvert.SerializeObject(new ErrorJson {error = true, message = ex.Message});
            }

            return received;
        }

        public static async Task<string> GetFromUri(Uri url, string authHeader = null)
        {
            string apiKey;
            try {
                apiKey = ApplicationData.Current.LocalSettings.Values["ApiKey"].ToString();
            }
            catch {
                apiKey = null;
            }

            authHeader = authHeader ?? apiKey;
            var received = String.Empty;
            try
            {
                var request = (HttpWebRequest)WebRequest.Create(url);
                if (!String.IsNullOrEmpty(authHeader))
                {
                    request.Headers["Authorization"] = authHeader;
                }
                var response = (HttpWebResponse) await request.GetResponseAsync();

                var stream = new StreamReader(response.GetResponseStream());
                received = await stream.ReadToEndAsync();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                received = JsonConvert.SerializeObject(new ErrorJson { error = true, message = ex.Message });
            }
            return received;
        }
    }
}
